
"""
import socket

print socket.gethostbyaddr(socket.getfqdn(socket.gethostname()))

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("www.nus.edu.sg", 80))
print s.getsockname()

"""

"""
import os
import multiprocessing as mp

def test():
    print "Current pid", os.getpid()
    while True: pass

if __name__ == "__main__":
    p = mp.Process(target=test)
    p.start()
"""

import sys
import traceback
from StringIO import StringIO 

def fa():
    raise Exception("hahaha")

def fb():
    fa()

try:
    fb()
except Exception as e:
    msg = StringIO()
    #traceback.print_tb(sys.exc_traceback, file=msg)
    print msg.getvalue()


class MasterTask(Task):
    def __init__(self):
        pass
    
    def __execute__(self, evo_devo):
        pass
    

from dexen.user.schemas.packing_boxes_v1 import tasks

class MyMasterTask(MasterTask):
    def __init__(self):
        pass
    
    def __run__(self, evo_devo):
        
        
        
        dev_task = tasks.development.DevelopmentTask
        evo_devo.start(dev_task, 100, "Development Task")
        evo_devo.stop(dev_task)
        
        while True:
            time.sleep(10)
        
        dev_task2 = tasks.development.DevelopmentTask("Development Task")
        dev_task2.set_input_size(fdasf)
        
        dev_task.num_waiting_inds()
        
        dev_task2.start()
        dev_task.stop()
        
        
        ind = evo_devo.get_ind(5)
        inds = evo_devo.get_cur_inds()
        
        evo_devo.set_ind(ind)

 